package com.yami.shop.api.controller;

import com.yami.shop.bean.meituan.OrderExpectionInfo;
import com.yami.shop.bean.meituan.OrderStatusInfo;
import com.yami.shop.service.OrderExpectionInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/MeituanOrderExpectionInfo")
public class OrderExpectionCallbackController {

    @Autowired
    private OrderExpectionInfoService orderExpectionInfoService;

    //获取订单状态改变回调
    @PostMapping("/getExpectionInfo")
    public ResponseEntity<Map> getOrderStatus(OrderExpectionInfo orderExpectionInfo){
        Map map = new HashMap();
        map.put("code","0");
        if(orderExpectionInfo!=null){
            orderExpectionInfo.setCreateTime(new Date());
            orderExpectionInfoService.saveOrUpdate(orderExpectionInfo);
        }
        return ResponseEntity.ok(map);
    }

}
